
#include "Vector3.h"

namespace ALittle
{

Vector3::Vector3() : x(0), y(0), z(0) { }

Vector3::Vector3( float xx, float yy, float zz ) : x(xx), y(yy), z(zz) { }

Vector3::Vector3( const Vector3& vec ) : x(vec.x), y(vec.y), z(vec.z) { }

Vector3::~Vector3() { }

float Vector3::Dot( const Vector3& vec ) const
{
	return x * vec.x + y * vec.y + z * vec.z;
}

Vector3 Vector3::Cross( const Vector3& vec ) const
{
	return Vector3(y * vec.z - z * vec.y, -x * vec.z + z * vec.x, x * vec.y - y * vec.x);
}

Vector3 Vector3::operator*( float scale )
{
	return Vector3(x * scale, y * scale, z * scale);
}

Vector3 Vector3::operator-()
{
	return Vector3(-x, -y, -z);
}

const Vector3& Vector3::operator+=( const Vector3& vec )
{
	x += vec.x;
	y += vec.y;
	z += vec.z;
	return *this;
}

const Vector3& Vector3::operator-=( const Vector3& vec )
{
	x -= vec.x;
	y -= vec.y;
	z -= vec.z;
	return *this;
}

} // ALittle
